/**
 * Created by xx on 2016/6/29.
 */
module.exports = function($){
    if(!$){
        return function () {
            console.error("cannot found $");
        }
    }
    var util = {};
    var emptyFn = function () {

    };
    util.clone = function (source, target) {
        if(!target){
            target = {};
        }
        if(!source) {
            return {};
        }
        return $.extend(true, target, source);
    }
    util.ajax = function(ops, promise){
        if (ops.url) {
            var opsTmp = util.clone(ops);
            if (!opsTmp['data']) {
                opsTmp['data'] = {};
            }
            opsTmp['data']['t'] = new Date().getTime();
            if(promise == true){
                return $.ajax( opsTmp );
            }else{
                $.ajax( opsTmp );
            }

        }
        return null;
    };


    var AV = function(){

    };
    AV.util = util;

    return AV;
};